﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartWMS.Common.ResponseOutput;
using SmartWMS.Domain.Base;
using SmartWMS.Domain.BasicsDatum;
using SmartWMS.Domain.FinanceManage;
using SmartWMS.Server.FinanceManage.PayTypeServices;
using SmartWMS.Server.FinanceManage.PayTypeServices.Dto;

namespace SmartWMS.API.Controllers.FinanceManage
{
    /// <summary>
    /// 财务类别管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "Finance")]

    public class PayTypeController : ControllerBase
    {
        private readonly IPayTypeService _payTypeService;

        public PayTypeController(IPayTypeService payTypeService)
        {
            _payTypeService = payTypeService;
        }

        /// <summary>
        /// 财务类别添加
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public  Task<Response<bool>> AddPayType(PayTypeDto dto)
        {
            var result =  _payTypeService.AddPayType(dto);
            return result;
        }

        /// <summary>
        /// 财务类别删除
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public  Task<Response<bool>> DeletePayType(PayTypeDto dto)
        {
            var result =  _payTypeService.DeletePayType(dto);
            return result;
        }

        /// <summary>
        /// 财务类别批量删除
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public  Task<Response<bool>> DeletePayTypeList(PayTypeDto dto)
        {
            var result =  _payTypeService.DeletePayTypeList(dto);
            return result;
        }

        /// <summary>
        /// 财务类别编辑
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public Task<Response<bool>> EditPayType(PayTypeDto dto)
        {
           var result =  _payTypeService.EditPayType(dto);
            return result;
        }

        /// <summary>
        /// 根据id获取财务类别
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public  Task<Response<PayTypeDto>> GetPayTypeById(KeyEntity id)
        {
            var result =  _payTypeService.GetPayTypeById(id);
            return result;
        }

        /// <summary>
        /// 财务类别列表
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpPost]
        public  Task<Response<List<PayTypeDto>>> GetPayTypeList(string? name)
        {
            var result =  _payTypeService.GetPayTypeList(name);
            return result;
        }
    }
}
